package com.ctrip.corp.obt.shard.sql.parser.forbidden;

import static com.ctrip.corp.obt.shard.constants.MaskConstants.MASK_PATTERN;

import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;

/**
 * 匹配所有取值带*的掩码数据 (兜底处理)
 * 
 * @author xukang zhang
 * @date 2023/11/14 9:58
 */
@AllArgsConstructor
@Slf4j
public class AllMaskForbiddenMatcher implements UpdateForbiddenMatcher {

    @Override
    public boolean match(String propertyName, Object propertyValue, Object parameterObject, String columnName) {
        if (!(propertyValue instanceof String)) {
            return false;
        }
        return MASK_PATTERN.matcher((String) propertyValue).matches();
    }

    @Override
    public int order() {
        return 500;
    }

}
